<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
    var number=prompt('请输入四位数：');
    var thousand=Math.floor(number/1000);
    var hundred=Math.floor((number/100)%10);
    var decade=Math.floor((number/10)%10);
    var digit=Math.floor(number%10);

    console.log(thousand);
    console.log(hundred);
    console.log(decade);
    console.log(digit);
    document.writeln('千位数：'+thousand+'<br>');
    document.writeln('百位数：'+hundred+'<br>');
    document.writeln('十位数：'+decade+'<br>');
    document.writeln('个位数：'+digit+'<br>');



</script>
</body>
</html>